package link;

import offer.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class leetCode145_postorderTraversal {
    List<Integer> res = new ArrayList<>();
    public List<Integer> postorderTraversal(TreeNode root) {
        if(root == null) return res;
        build(root);
        return res;
    }
    public void build(TreeNode root){
        if(root == null) return;
        build(root.left);
        build(root.right);
        res.add(root.val);
    }

}
